﻿{% extends "base_cn.html" %}
{% block title %} -- 系统配置 {% endblock %}
{% block content %}


<script type="text/javascript" src="/static/json2.js"></script>
<script type="text/javascript">
	//
	// As mentioned at http://en.wikipedia.org/wiki/XMLHttpRequest
	//
	if( !window.XMLHttpRequest ) XMLHttpRequest = function()
	{
		try{ return new ActiveXObject("Msxml2.XMLHTTP.6.0") }catch(e){}
		try{ return new ActiveXObject("Msxml2.XMLHTTP.3.0") }catch(e){}
		try{ return new ActiveXObject("Msxml2.XMLHTTP") }catch(e){}
		try{ return new ActiveXObject("Microsoft.XMLHTTP") }catch(e){}
		throw new Error("Could not find an XMLHttpRequest alternative.");
	};

	function OnSendFinish(response)
	{
	    if(1 == Number(response))
	    {
		alert('设置成功！');
	    }
	    else
	    {
		alert('设置失败！');
	    }
	}

	function OnResetRssCatch(RssName)
	{
	    alert(RssName);
//	    var JsonString = JSON.stringify(RssName); 

	    var req = new XMLHttpRequest();
	    req.open('GET', '/rss_reset_rpc?rssname=' + encodeURIComponent(RssName), true);

	    req.onreadystatechange = function()
	    {
		if(req.readyState == 4 && req.status == 200)
		{
		    var response = null;
		    try
		    {
			response = JSON.parse(req.responseText);
		    }
		    catch (e)
		    {
			response = req.responseText;
		    }

		    OnSendFinish(response);
		}
	    }
		
	    req.send(null);
	}
</script>




{% if IsAdmin %}

{% if AdminConfig %}
<form action="/admin" method="post" name="form-admin">
  <table borderColor=#cccccc cellSpacing=0 cellPadding=3 width="100%" bgColor=#ffffff border=2>

    <tr>
	<td>&nbsp;每微博积分：</td>
	<td><input type="text" name="IntegralPreBlog" value="{{ AdminConfig.IntegralPreBlog }}" ></input></td>
    </tr>

    <tr>
	<td>&nbsp;每评论积分：</td>
	<td><input type="text" name="IntegralPreCommentOn" value="{{ AdminConfig.IntegralPreCommentOn }}" ></input></td>
    </tr>

    <tr>
	<td>&nbsp;每介绍一个人加入：</td>
	<td><input type="text" name="IntegralPreJoin" value="{{ AdminConfig.IntegralPreJoin }}" ></input></td>
    </tr>

    <tr>
	<td>&nbsp;完善注册信息：</td>
	<td><input type="text" name="IntegralRegister" value="{{ AdminConfig.IntegralRegister }}" ></input></td>
    </tr>

    <tr>
	<td>&nbsp;发布需要审核：</td>
	<td>
		<input type="radio" name="MicroblogNeedAuditing" value="0" {% ifequal AdminConfig.MicroblogNeedAuditing 0 %}checked{% endifequal %}>不需要审核
		<input type="radio" name="MicroblogNeedAuditing" value="1" {% ifequal AdminConfig.MicroblogNeedAuditing 1 %}checked{% endifequal %}>需要审核
	</td>
    </tr>

    <tr>
	<td>&nbsp;匿名用户是否可以评论：</td>
	<td>
		<input type="radio" name="AnonymousCanCommentON" value="0" {% ifequal AdminConfig.AnonymousCanCommentON 0 %}checked{% endifequal %}>可以评论
		<input type="radio" name="AnonymousCanCommentON" value="1" {% ifequal AdminConfig.AnonymousCanCommentON 1 %}checked{% endifequal %}>不可以评论
	</td>
    </tr>

    <tr>
	<td></td>
	<td><input type="submit" value="提交"/></td>
    </tr>

  </table>
</form>
{% endif %}


<p align="center">
	<input type="button" onclick="OnResetRssCatch('hotblog')" value="重设最热话题RSS">&nbsp;
	<input type="button" onclick="OnResetRssCatch('newblog')" value="重设最新话题RSS">&nbsp;
	<input type="button" onclick="OnResetRssCatch('hotcollect')" value="重设最热收藏RSS">&nbsp;
	<input type="button" onclick="OnResetRssCatch('newcollect')" value="重设最新收藏RSS">&nbsp;
	<input type="button" onclick="OnResetRssCatch('hotlike')" value="重设最受欢迎RSS">&nbsp;
	<input type="button" onclick="OnResetRssCatch('newlike')" value="重设最新喜爱RSS">&nbsp;
</p>


{% endif %}

{% endblock %}